﻿using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;

public class ByteCompare : MonoBehaviour
{
	private void Awake()
	{
		StartCoroutine(CorRandom());
	}

	IEnumerator CorRandom()
	{
		while (Application.isPlaying)
		{
			Debug.Log(UnityEngine.Random.Range(0, 10));
			yield return new WaitForSeconds(0.5f);
		}
	}
	// Start is called before the first frame update
	void Start1()
    {
	
		string content = "Number";

		byte[] textByte = Encoding.UTF8.GetBytes(content);
		byte[] msByte;
		using (MemoryStream ms = new MemoryStream()) {
			using (BinaryWriter bw = new BinaryWriter(ms)) {

				bw.Write(Encoding.UTF8.GetBytes(content));
				msByte = ms.ToArray();
			}
		}

		Debug.Log("Complete");
		for (int i = 0; i < textByte.Length; i++)
		{
			Debug.Log($"{i}  : {textByte[i]} => {msByte[i]}");
		}
	}

	
}
